package com.xc.shopping_font.Controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xc.shopping_font.entity.ProductCategory;
import com.xc.shopping_font.mapper.ProductCategoryMapper;
import com.xc.shopping_font.service.ProductCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Slf4j
@RequestMapping("/productcat")
public class ProductCategoryController {

    @Resource
    public ProductCategoryMapper productCategoryMapper;


    @GetMapping("/CatList")
    public List<ProductCategory> getCatList(){

        QueryWrapper<ProductCategory> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id",0);

        List<ProductCategory> productCategories = productCategoryMapper.selectList(queryWrapper);


        return productCategories;

    }


}
